package jogs.games;

import java.io.Serializable;
//import java.util.*;

import jogs.Player;
import jogs.games.crazyeights.*;
import jogs.GameServer;

public abstract class Game implements Serializable
{
	private static Integer gameCount = 1;
	
	protected String gameName;
	protected int maxPlayers;
	protected int minPlayers;
	protected int currentPlayers;
	
	public abstract void chat(String message, Player p);
	
	public abstract void move(Player p, String move);	
	
	public abstract String getStatus();
	
	public abstract int getNumPlayers();
	
	public abstract boolean join(Player p);
	
	public abstract void leave(Player p);
	
	public abstract void close();
	
	public int getMaxPlayers()
	{
		return maxPlayers;
	}
	
	public String getName()
	{
		return gameName;	
	}
	
	
	public void setMaxPlayers(int i)
	{
		maxPlayers = i;
	}
	
	public void setName(String name)
	{
		gameName = name;			
	}
	
	//Static Methods
	//==============================================================================
	public static Game newGame(String gameName, String gameType, GameServer parent, int maxPlayers)
	{
		Game r = null;
		if(gameType.equals("chat"))
		{
			//r = new ChatGame(gameName);
		}
		else if(gameType.equals("crazyeights"))
		{
			r = new CrazyEights(gameName, parent, maxPlayers);
		}
		return r;
	}	

	public static String getNextGameName()
	{
		String gameName = gameCount.toString();
		gameCount++;
		return gameName;
	}
}

